﻿using System;
using System.Text;
using System.Collections;
using System.Collections.Generic;
using Esint.Common;
using Esint.Common.Model;
using Esint.Common.Web;
using Esint.JudicialAuction.Model.Common;
using Esint.Common.Model.DbAttribute;

namespace Esint.JudicialAuction.Model
{
    /// <summary>
    /// 文件说明: 信息实体
    /// 作    者: 谷明
    /// 生成日期: 2020年03月12日
    /// 生成模板: Esint.Template.Model.Model_02 版
    /// 修改说明：
    /// </summary>
    public partial class Sys_UserInfo : BaseModel
    {
        public override void ValidData()
        {
            if (this.Cellphone.IsEmptyButNotNull()) throw new DataValidException($"{((Cellphone.GetType().GetCustomAttributes(false))[0] as DbColumnAttribute).Commet}{Validator.CannotBeEmpty}");
            if (this.UserName.IsEmptyButNotNull()) throw new DataValidException($"{((UserName.GetType().GetCustomAttributes(false))[0] as DbColumnAttribute).Commet}{Validator.CannotBeEmpty}");
            if (this.UserPwd.IsEmptyButNotNull()) throw new DataValidException($"{((UserPwd.GetType().GetCustomAttributes(false))[0] as DbColumnAttribute).Commet}{Validator.CannotBeEmpty}");
            if (this.UserType.IsEmptyButNotNull()) throw new DataValidException($"{((UserType.GetType().GetCustomAttributes(false))[0] as DbColumnAttribute).Commet}{Validator.CannotBeEmpty}");
            if (this.Status.IsEmptyButNotNull()) throw new DataValidException($"{((Status.GetType().GetCustomAttributes(false))[0] as DbColumnAttribute).Commet}{Validator.CannotBeEmpty}");

            if (!Validator.IsMobile(this.Cellphone)) throw new DataValidException($"{((Cellphone.GetType().GetCustomAttributes(false))[0] as DbColumnAttribute).Commet}{Validator.FormatError}");


        }

        public List<Sys_UserPowerInfo> UserPowerList
        {
            get {
                if (UserPowerList == null)
                {
                    UserPowerList = new List<Sys_UserPowerInfo>();
                }
                return UserPowerList;
            }
            set {
                UserPowerList = value;
            }
        }
    }
}
